﻿<cfscript>
/** 
* ORM StudentMark
* 
* @hint "Hibernate persistenter t_student_mark. 学生学期成绩记录表" 
* 
*/ 

component 
	displayname="public.service.orm.senate.StudentMark" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="StudentMark" 
	table="t_student_mark"
	{
		
	property type="string" name="MarkID" column="scm_id" fieldtype="id" generator="assigned" hint="学生成绩编号";
		
	property type="string" name="Retaking" column="retaking" hint="是否重修标志";
	property type="string" name="MarkMode" column="mark_mode" hint="计分模式";
		
	property type="numeric" name="Mark" column="mark_result" hint="成绩";
	property type="string" name="MarkNote" column="mark_note" hint="成绩备注";
		
	property type="numeric" name="MarkResit" column="mark_resit" hint="补考成绩";
	property type="string" name="MarkResitNote" column="mark_renote" hint="补考成绩备注";
	property type="numeric" name="MarkResitLimit" column="mark_resit_limit" hint="补考成绩上限";
		
	property type="string" name="TaskType" column="task_type" hint="教学任务类别";
	property type="string" name="TaskID" column="task_id" hint="教学任务号";
		
	property type="string" name="MarkTime" column="mark_time" hint="正考登录时间";
	property type="string" name="MarkResitTime" column="mark_resit_time" hint="补考登录时间";
		
	property type="string" name="ChooseID" column="scc_id" hint="学生选课号";

	property type="string" name="Remarks" column="remarks" hint="备注";
		
	property name="Student" fieldtype="many-to-one" fkcolumn="stu_id" cfc="Student"  hint="学生";
	property name="Course" fieldtype="many-to-one" fkcolumn="cid" cfc="Course"  hint="课程";
	property name="Term" fieldtype="many-to-one" fkcolumn="term_id" cfc="Term"  hint="学期";
	property name="CourseProperty" fieldtype="many-to-one" fkcolumn="prop_id" cfc="CourseProperty"  hint="课程属性";
	property name="Teacher" fieldtype="many-to-one" fkcolumn="tch_id" cfc="Teacher"  hint="成绩提交教师";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @Student "学生"
	* @Course "课程"
	* @Term "学期"
	* @TaskType "教学任务类别"
	*/	
	public string function getID( required Student, required Course, required Term, required string TaskType ) output=false {
		
		var nextID = arguments.Student.getStudentID() & "," & arguments.Course.getCourseID() & "," & arguments.Term.getTermID() & arguments.TaskType;

		/* 
			主键生成规则 
			
			选课号36位 8位学号 , 6位课程号 , 3位学期代码+教学任务类别

			Unique: STU_ID, CID, TERM_ID, TASK_TYPE
		*/
		return nextID;
	}
		
}
	
</cfscript>